package cn.itcast.controller;

import cn.itcast.domain.MetaDatabase;
import cn.itcast.service.MetaDatabaseService;
import cn.itcast.utils.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * create by zhangtian on 2019/1/11
 */
@RestController
@RequestMapping(value = "meta/database")
public class MetaDatabaseController {

    @Autowired
    private MetaDatabaseService metaDatabaseService ;

    @PostMapping
    public ServerResponse<MetaDatabase> saveMetaDatabase(@ModelAttribute MetaDatabase metaDatabase) {
        return metaDatabaseService.saveMetaDatabase(metaDatabase) ;
    }

    @GetMapping
    public ServerResponse<Iterable<MetaDatabase>> findAllMetaDatabase() {
        return metaDatabaseService.findAllMetaDatabase() ;
    }
}
